<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored ="false" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>学生列表页</title>
</head>
<body>
<div>
    <h2><span>学生列表</span></h2>

    <c:choose>
        <c:when test="${empty studentList}">
            <tr>列表为空</tr>
        </c:when>
        <c:otherwise>
            <table border="1">
                <tr>
                    <th>id</th>
                    <th>名字</th>
                    <th>指导老师</th>
                    <th>操作</th>
                </tr>
                <tbody>
                    <c:forEach items="${studentList}" var="student">
                        <tr>
                            <td>${student.id}</td>
 							<td>${student.name}</td>
 							<td>${student.teacher.name}</td>
                            <td><a href="/zhengweixin/student/updatePage?id=${student.id}">编辑</a> &nbsp;<a href="/zhengweixin/student/delete?id=${student.id}">删除</a></td>
                        </tr>
                    </c:forEach>
                </tbody>
            </table>
        </c:otherwise>
    </c:choose>
    <div>
        <p>
            <a href="/zhengweixin/student/addPage">添加学生</a> &nbsp; <a href="/zhengweixin/">返回首页</a>
        </p>
    </div>
</div>
</body>
</html>